package com.example.demo.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


@Mapper
public interface TeacherMapper extends BaseMapper<Teacher> {

    //来一个自定义sql语句
    @Select("SELECT * from teacher limit #{page},#{limit}")
    List<Teacher> getTeacherPage(int page, int limit);


    @Select("select * from teacher where username = #{username}")
    List<Teacher>  getTeacherByUsername(String username);



    @Update("update teacher set ${field} = #{value} where id =#{id} ")
    int updateTeacherById(int id,String field,String value);

}
